<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>业务规则调用日志详情</title>
<link href="../../static/plugin/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
<link href="../../static/plugin/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
<link href="../../static/css/esaas-easyui-view.css" rel="stylesheet" type="text/css"/>
<script src="../../static/plugin/easyui/jquery.min.js" type="text/javascript"></script>
<script src="../../static/plugin/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../static/plugin/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>

<link rel="stylesheet" href="../../static/plugin/highlight/styles/default.css">
<!--<script src="../../static/plugin/highlight/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>-->

<script src="../../ffres/dict/all.js" type="text/javascript"></script>
<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<body class="easyui-layout">

        <div id="aa" class="easyui-accordion easyui-resizable" style="width:100%;height:100%;">
            <div title="规则集日记详细信息" data-options="selected:true" style="overflow:auto;padding:10px;">
                <form id="ff" method="post">
                    <div class="esaas-info-title">业务规则调用日志信息</div>
                    <table class="esaas-info-view-table">
                        <tr>
                            <td width="15%" align="right">日志记录标识：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="logId" data-options="required:true"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">业务流水号：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="bizSerno" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">适配机构代码：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterOrgNo" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">适配机构名称：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterOrgName" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">适配流程ID：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterFlowId" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">适配流程名称：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterFlowName" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">适配产品编号：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterPrdCode" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">适配产品名称：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterPrdName" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">适配业务系统代码：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterSysCode" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">适配的自定义维度1：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterCustomDim1" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">适配的自定义维度2：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="adapterCustomDim2" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">目标规则类型：</td>
                            <td width="35%"><select class="easyui-combobox"
                                                    id="ruleTargetType" name="ruleTargetType"
                                                    style="width: 100%; height: 25px;" disabled
                                                    data-options="required:false,editable:false,valueField:'enname',textField:'cnname',data:RULE_TARGET_TYPE">
                            </select></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">目标规则ID：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="ruleTargetId" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">目标规则名称：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="ruleTargetName" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">规则执行结果：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="ruleExecResult" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                            <td width="15%" align="right">操作人：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="operUserid" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <tr>
                            <td width="15%" align="right">操作时间：</td>
                            <td width="35%"><input class="easyui-textbox" type="text" disabled
                                                   name="operTime" data-options="required:false"
                                                   style="width: 100%; height: 25px;"></input></td>
                        </tr>
                        <!--<tr>
                            <td width="15%" align="right">请求信息：</td>
                            <td width="35%">
                                <input class="easyui-textbox" type="text" readonly
                                                   name="requestBody" data-options="required:false,multiline:true"
                                                   style="width: 100%;height:100px;"></input>
                            </td>
                            <td width="15%" align="right">响应信息：</td>
                            <td width="35%">
                                <input class="easyui-textbox" type="text" readonly
                                                   name="responseBody" data-options="required:false,multiline:true"
                                                   style="width: 100%;height:100px;"></input>
                            </td>
                        </tr>-->
                    </table>
                    <div class="row" style="height:350px;">
                        <div class="col-right" >
                            <p align="center">请求信息</p>
                            <pre class="pre_code">
                                <code id="requestBody" class="json"></code>
                            </pre>
                        </div>
                        <div class="col-left">
                            <p align="center">响应信息</p>
                            <pre class="pre_code">
                                <code id="responseBody" class="json"></code>
                            </pre>
                        </div>
                    </div>
                    <!--<table class="esaas-info-view-table" style="padding: 0 0 0 5%;">
                        <tr>
                            <td width="50%" class="code_td">
                                <p align="center">请求信息</p>
                                <pre class="pre_code">
                            <code id="requestBody" class="json"></code>
                        </pre>
                            </td>
                            <td width="50%" class="code_td">
                                <p align="center">响应信息</p>
                                <pre class="pre_code">
                            <code id="responseBody" class="json"></code>
                        </pre>
                            </td>
                        </tr>
                    </table>-->
                </form>
            </div>
            <div title="规则明细日记" data-options="" style="padding:10px;">
                <div data-options="region:'north',title:''" style="height: 40px;">
                    <form id="searchForm">
                        <table>
                            <tr>
                                <td>&nbsp;规则id：</td>
                                <td><input name="ruleId" id="ruleId"/></td>
                                <td>&nbsp;规则名称：</td>
                                <td><input name="ruleName" id="ruleName"/></td>
                                <td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="queryDetailList()">查找</a></td>
                                <td><a class="easyui-linkbutton" href="javascript:void(0);" onclick="JLEUtil.clearForm('searchForm');">清空</a></td>
                            </tr>
                        </table>
                    </form>
                </div>
                <table id="dtlDg" class="easyui-datagrid" style="width:100%;height:100%"
                       data-options="singleSelect:true,url:'../../api/biz/rule/log/details',method:'post'"
                       title="Load Data"
                       sortName="ruleExeDt" sortOrder="desc"
                       rownumbers="true" pagination="true" pageSize="10" pagePosition="top" pageList="[5,10,20,30]">
                    <thead>
                    <tr>
                        <!--<th data-options="field:'logId',resizable:true" >日志记录标识</th>-->
                        <th data-options="field:'ruleCollId',resizable:true" >规则集id</th>
                        <th data-options="field:'bizSerno',resizable:true" >业务流水号</th>
                        <th data-options="field:'ruleId',resizable:true" sortable="true">规则id</th>
                        <th data-options="field:'ruleName',resizable:true" sortable="true">规则名称</th>
                        <th data-options="field:'paramVal',resizable:true,width:300" >参数值</th>
                        <th data-options="field:'exeVal',resizable:true,width:300" >执行值</th>
                        <th data-options="field:'exeResult',resizable:true" formatter="formatter_EXE_RESULT">规则执行结果</th>
                        <th data-options="field:'ruleExeDt',resizable:true" sortable="true">规则执行时间</th>
                    </tr>
                    </thead>
                </table>
            </div>
        </div>


	    <!--<div style="text-align:center;padding:15px">
			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeForm()">&nbsp;关&nbsp;闭&nbsp;</a>
	    </div>-->
    <style type="text/css">
        .row {
            margin-right: -15px;
            margin-left: -15px;
        }
        .col-right, .col-left {
            position: relative;
            min-height: 1px;
            padding-right: 1%;
            padding-left: 1%;
        }
        .col-right, .col-left {
            float: left;
            width: 48%;
        }
        .code_td {
            background: #F0F0F0;
        }
        .code_td p {
            margin: 1em 0 0 0;
        }
        .pre_code {
            height: 300px;
            display: block;
            overflow: scroll;
            background: #F0F0F0;
        }
        .pre_code code {
        }
    </style>
	<script>
        var bizSerno ;
		$(function() {
			var logId = $.getUrlParam('logId');
			$.restfulGet('../../api/biz/rule/log/' + logId,null,function(data){
					$('#ff').form('load', {
						logId : data.rows.logId,
						bizSerno : data.rows.bizSerno,
						adapterOrgNo : data.rows.adapterOrgNo,
						adapterOrgName : data.rows.adapterOrgName,
						adapterFlowId : data.rows.adapterFlowId,
						adapterFlowName : data.rows.adapterFlowName,
						adapterPrdCode : data.rows.adapterPrdCode,
						adapterPrdName : data.rows.adapterPrdName,
						adapterSysCode : data.rows.adapterSysCode,
						adapterCustomDim1 : data.rows.adapterCustomDim1,
						adapterCustomDim2 : data.rows.adapterCustomDim2,
						ruleTargetType : data.rows.ruleTargetType,
						ruleTargetId : data.rows.ruleTargetId,
						ruleTargetName : data.rows.ruleTargetName,
						requestBody : data.rows.requestBody,
						responseBody : data.rows.responseBody,
						ruleExecResult : data.rows.ruleExecResult,
						operUserid : data.rows.operUserid,
						operTime : data.rows.operTime
					});
                    bizSerno = data.rows.bizSerno;
                    try {
                        var req = JSON.stringify(JSON.parse(data.rows.requestBody), null, 2);
                        $('#requestBody').text(req);
                    } catch (e) {
                        $('#requestBody').text(data.rows.requestBody);
                    }
                    try {
                        var resp = JSON.stringify(JSON.parse(data.rows.responseBody), null, 2);
                        $('#responseBody').text(resp);
                    } catch (e) {
                        $('#responseBody').text(data.rows.responseBody);
                    }

                    $('#dtlDg').datagrid({queryParams:{bizSerno: bizSerno} });
			});

            $( ".pre_code code" ).dblclick(function(e) {
                var id = $(e.currentTarget).attr("id");
                copyToClipboard(id);
            });
		});
		function closeForm(){
			window.parent.JLEUtil.closewin();
		}

        function copyToClipboard(id) {
            var target = document.getElementById(id);
            var selection = window.getSelection();
            selection.removeAllRanges();
            var range = document.createRange();
            range.selectNode(target);
            selection.addRange(range);
            document.execCommand("copy");

            $.messager.show({
                title:'提示',
                msg:'已复制',
                showType:'show',
                style:{
                    left:'',
                    right:0,
                    top:document.body.scrollTop+document.documentElement.scrollTop,
                    bottom:''
                }
            });
        }

        function queryDetailList() {
            var param = $("#searchForm").serializeJson();
            param.bizSerno = bizSerno;
            $('#dtlDg').datagrid('load', param);
        }

	</script>
</body>
</html>
